﻿using System;


namespace LoD.WPClientLibrary.Animations {
    public class Spin : Animation {
        private readonly float _velocity;
        private float _angleDist;

        public Spin(float velocity) {
            Animating = true;
            this._velocity = velocity;
            this._angleDist = 0.0f;
        }

        public override float ModifyRotation(float original) {
            if (Animating) {
                const float fullCircle = (float)(2.0 * Math.PI);
                this._angleDist += this._velocity;
                if (this._angleDist > fullCircle) Animating = false;

                original += this._velocity;
            }
            return original;
        }
    }
}